Generally, an electronic device such as a mobile phone or a PDA (Personal Digital Assistant) can be connected to an external audio device such as a headset or a sound box. By means of a connection to a headset, an audio output channel can be switched from a speaker or an earpiece that is disposed on a main body of an electronic device to the headset, so as to facilitate usage by a user.
In the past, when audio is played by using a headset, if an application program associated with the audio may require to be controlled (for example, the application program is started, paused, or converted), a user may require to manually operate an electronic device or a headset connected to the electronic device. For example, in cases such as getting on a vehicle or crossing a road, a user may need to take off, from the head, a headset that is outputting audio. However, in this case, an application program associated with the audio does not automatically stop running, and the user may require to manually operate an electronic device so that the application program can be stopped and playback of the audio can be stopped. For another example, when a mobile phone is connected to a Bluetooth headset, to switch an audio output channel of an incoming call to an earpiece of the mobile phone, a user may require to perform manual switch by operating the Bluetooth headset.
In a state in which an electronic device is connected to a headset, control of an application program associated with audio depends on a manual operation of a user and cannot be automatically performed. The control of the application program is complex, and is not easy for the user to operate.